﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace System
{
    public static class JsonExtent
    {
        /// <summary>
        /// 序列化对象
        /// </summary>
        /// <param name="obj">需要被序列化的对象</param>
        /// <returns></returns>
        public static String Serialize(this Object obj)
        {
            return System.Json.Convert.SerializeObject(obj);
        }

        /// <summary>
        /// 反序列化字符串
        /// </summary>
        /// <param name="json">需要被反序列化的Json字符串</param>
        /// <param name="t">反系列化的目标对象的type</param>
        /// <returns></returns>
        public static Object Deserialize(this String json, Type t)
        {
            return System.Json.Convert.DeserializeObject(json, t);
        }

      
    }
}
